#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pymysql

# 数据库连接信息
HOST = '192.140.166.115'
USER = 'phoenixfm_cn'
PASSWORD = '3b7SiXCWSe8B6pyi'
DATABASE = 'phoenixfm_cn'

try:
    # 连接数据库
    conn = pymysql.connect(host=HOST, user=USER, password=PASSWORD, database=DATABASE)
    print(f"成功连接到数据库: {DATABASE}")
    
    # 创建游标
    cursor = conn.cursor()
    
    # 查询数据库中的所有表
    cursor.execute("SHOW TABLES")
    tables = cursor.fetchall()
    
    print("数据库中的表:")
    for table in tables:
        print(f"  - {table[0]}")
    
    # 关闭游标和连接
    cursor.close()
    conn.close()

except Exception as e:
    print(f"数据库操作失败: {e}")